import React, { Component } from 'react';
import QRCode from 'qrcode.react';
import './index.css'

export default class Alert extends Component {

  clk() {
    var res = !this.props.show
    this.props.callbackParent(res);
  }
  render() {
    let { show, text } = this.props;
    let lottery_text = null;
    if (text === '谢谢参与') {
      lottery_text = <div className='msg xeixie'>{text}</div>;
    } else {
      lottery_text = <div className='msg'>
        <div>恭喜您获得<span>{text}元现金！</span></div>
        <div className='qrcode'>
          <QRCode value="https://fuyuan.wang" size={170} />
        </div>
        <div className='alipay'>请打开支付宝扫码领取</div>
      </div>;
    }
    return (
      <div>
        {
          show &&
          <div className='alert'>
            <div className='mask'></div>
            <div className='alert-content'>
              {lottery_text}
              <div className='button' onClick={() => this.clk()}>我不需要该奖品</div>
            </div>
          </div>
        }
      </div>
    )
  }
}